package HomeWork;

import java.io.File;
import java.io.IOException;
import java.util.Scanner;

public class HomeWork01 {
    public static void main(String[] args) throws IOException {
        Scanner scan = new Scanner(System.in);
        do {
            //输入
            System.out.println("请输入文件，名称；");
            String str = "./" + scan.next();

            File file = new File(str);
            if (file.exists()) {
                System.out.println(file.getName() + ",该文件已存在！请重新输入！");
            } else {
                System.out.println("该文件不存在。");
                file.createNewFile();
                System.out.println("文件创建完毕！");
                break;
            }
        }while(true);

    }
}
